import { init } from 'snabbdom/build/package/init'
import { h } from 'snabbdom/build/package/h'

let patch = init([])

let vnode = h('div#app', [
    h('h1', 'hello'),
    h('h2', 'word'),
    'wlz'
])

let app = document.querySelector('#app')

let oldVnode = patch(app, vnode)

setTimeout(() => {
    vnode = h('div#app', [
        h('h1', '1111'),
        h('h2', '2222'), 
        'wlz'
    ])
    patch(oldVnode, vnode)

    // 清空页面元素
    // patch(oldValue, null) // 错误的
    patch(oldVnode, h('!'))
}, 2000);